<?php

declare(strict_types=1);

namespace app\admin\logic\server;

use app\common\model\server\Comment;


/**
 * 评论分组
 */
class CommentLogic
{
    /**
     * @notes 评论列表
     * @param array $param
     * @return \think\response\Json
     */
    public static function lists(array $param)
    {
        $list = Comment::custom($param)
            ->with('service')
            ->order('id desc')
            ->pages($param)
            ->select();
        return list_fmt($list, Comment::custom($param)->count());
    }
    
    /**
     * 添加评论
     * @param array $data 评论数据
     * @return object
     */
    public static function comment($data){
		return Comment::create($data);
    }
    /**
     * @notes 删除评论
     * @param integer $id
     * @return bool
     */
    public function delete($id)
    {
       return Comment::whereIn('id',$id)->delete();
    }
}
